@import (reference) "../defs.less";

.split-btn {
  box-shadow: @btn-box-shadow;
  cursor: pointer;
  display: inline-block;

  .btn {
    border: 1px solid @btn-border-color;
    border-bottom-color: @btn-border-bottom-color;
    border-radius: 0;

    &.primary-btn {
      border-radius: @btn-border-radius 0 0 @btn-border-radius;

      &.drop-down-shown {
        border-radius: @btn-border-radius 0 0 0;
        border-bottom: 0;
      }

      &.drop-up-shown {
        border-radius: 0 0 0 @btn-border-radius;
        border-top: 0;
      }
    }

    &.drop-down-btn {
      border-left: none;
      border-radius: 0 @btn-border-radius @btn-border-radius 0;

      &.drop-down-shown {
        border-radius: 0 @btn-border-radius 0 0;
        border-bottom: 0;
      }

      &.drop-up-shown {
        border-radius: 0 0 @btn-border-radius 0;
        border-top: 0;
      }
    }
  }
}

.split-btn-alternatives {
  box-shadow: @btn-box-shadow;
  cursor: pointer;

  .btn {
    border-radius: 0;
    display: block;
  }

  &.drop-down-shown {
    .btn {
      border-bottom: 0;

      &:last-child {
        border-bottom: 1px solid @btn-border-bottom-color;
        border-radius: 0 0 @btn-border-radius @btn-border-radius;
      }
    }
  }

  &.drop-up-shown {
    .btn {
      border-top: 0;

      &:first-child {
      }
      border-radius: @btn-border-radius @btn-border-radius 0 0;
      border-top: 1px solid @btn-border-color;
    }
  }
}

a.btn {
  text-decoration: none;
}

.btn,
input[type="button"],
input[type="submit"] {
  // Button Base
  cursor: pointer;
  display: inline-block;

  // Don't use .gradientbar() here since it does a three-color gradient
  #gradient > .vertical-three-colors(#ffffff, #ffffff, 25%, darken(#ffffff, 10%));

  border-bottom-color: @btn-border-bottom-color;
  border-radius: 4px;
  border: 1px solid @btn-border-color;
  box-shadow: @btn-box-shadow;
  color: #333;
  font-size: 13px;
  line-height: normal;
  padding: 3px 8px;
  text-shadow: 0 1px 1px rgba(255,255,255,.75);

  // Transitions
  transition: .1s linear all;

  &[disabled] {
    // disabled pseudo can't be included with .disabled
    // def because IE8 and below will drop it ;_;
    cursor: default;
    background-image: none;
    .ie-reset-gradients();
    opacity: 0.65;
    box-shadow: none;
  }

  // Active and Disabled states
  &:active {
    box-shadow: inset 0 2px 4px rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.05);
  }

  &:hover, &.hover {
    background-position: 0 -15px;
    color: #333;
    text-decoration: none;
  }

  &.danger {
    color: white !important;
    .gradientBar(#ee5f5b, #c43c35);
  }

  &.disabled {
    cursor: default;
    background-image: none;
    .ie-reset-gradients();
    opacity: 0.65;
    box-shadow: none;
  }

  // Primary Button Type
  &.primary, &.default {
    color: white;
    text-shadow: none;

    .gradientBar(@btn-primary-color1, @btn-primary-color2);
  }

  // Button Sizes
  &.large {
    font-size: 130%;
    line-height: normal;
    padding: 9px 14px 9px;
    border-radius: 6px;
  }

  &.small {
    padding: 7px 9px 7px;
    font-size: 11px;
  }
}

/*
 * Force Firefox to render our buttons with our chosen font. Otherwise it will
 * be overridden (on macOS at least) with the system font.
 */
input[type="button"],
input[type="submit"] {
  font-family: @font-family;
}

// Help Firefox not be a jerk about adding extra padding to buttons
button.btn,
input[type=submit].btn {
  &::-moz-focus-inner {
    padding: 0;
    border: 0;
  }
}
